import {
	SET_CATE
} from './mutation-types.js'

import {
	getCateList,
} from '@/api/home.js'

export default {
	namespaced: true,
	state: {
		cateList: []
	},
	getters: {},
	// 更改数据的方法
	mutations: {
		[SET_CATE](state, val) {
			state.cateList = val
		},
	},
	actions: {
		getCateData({
			commit
		}) {
			getCateList().then(({
				data,
				code
			}) => {
				// this.list = res.data
				commit('SET_CATE',data)
			}).catch(err => {
				console.log(err)
			});
		}
	},
	modules: {}
}
